gdk/gdkglcontext.c: Avoid a GCCism
authorChun-wei Fan <fanchunwei@src.gnome.org>
Tue, 26 Apr 2016 12:29:23 +0000 (20:29 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Tue, 26 Apr 2016 12:29:23 +0000 (20:29 +0800)
Pointer arithmetic on GLvoid* (a void*) is a GCCism, so cast it to an
unsigned char*, which is the type cairo_image_surface_get_data() returns.

gdk/gdkglcontext.c

index 87534c6eecad32509c3ddac3d9d8d57005e917af..44ef88b59a7ef4db38ee38e22046f232a7ad0def 100644 (file)
@@ -274,14 +274,14 @@ gdk_gl_context_upload_texture (GdkGLContext    *context,
           glTexImage2D (texture_target, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
 
           for (i = 0; i < height; i++)
-            glTexSubImage2D (texture_target, 0, 0, i, width, 1, GL_RGBA, GL_UNSIGNED_BYTE, data + (i * stride));
+            glTexSubImage2D (texture_target, 0, 0, i, width, 1, GL_RGBA, GL_UNSIGNED_BYTE, (unsigned char*) data + (i * stride));
         }
       else
         {
           glTexImage2D (texture_target, 0, GL_RGBA, width, height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
 
           for (i = 0; i < height; i++)
-            glTexSubImage2D (texture_target, 0, 0, i, width, 1, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, data + (i * stride));
+            glTexSubImage2D (texture_target, 0, 0, i, width, 1, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, (unsigned char*) data + (i * stride));
         }
     }
 }